<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		  <#assign base=request.contextPath  />
		 <link rel="stylesheet" href="${base}/js/layui/css/layui.css?t=1534970980648" media="all">
		 <script type="text/javascript" src="${base}/js/zhang.js"></script>
		 <script src="${base}/js/layui/layui.js" charset="utf-8"></script>
         <script type="text/javascript" src="${base}/js/ztree/jquery-1.4.4.min.js"></script>
         <script src="${base}/js/jquery.min.js"></script>

		<style type="text/css">
		form{
		  padding:20px;
		}
		.layui-btn-radius{
                			border-radius: 5px;
                		}
		</style>
	</head>
	<body>

	<form class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><a style="color:red">*</a>&nbsp;房间号</label>
                <div class="layui-input-block" style="width:190px">
                    <select name="city"  lay-search="" lay-verify="required" class=" isNull" id="home_id">
                        <option value="">请选择房间号</option>
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"style="width:90px" ><a style="color:red">*</a>&nbsp;姓名</label>
                <div class="layui-input-inline">
                    <input name="number" id="name" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">

                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><a style="color:red">*</a>&nbsp;性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex"  value="男" title="男" >
                    <input type="radio" name="sex" value="女" title="女" checked="" >
                </div>
            </div><br/>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;育婴师</label>
                <div class="layui-input-inline">
                    <input name="number" id="babynursery" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;责任护士</label>
                <div class="layui-input-inline">
                    <input name="number" id="people" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;分娩方式</label>
                <div class="layui-input-inline">
                    <input name="number" id="delivery" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;入住天数</label>
                <div class="layui-input-inline">
                    <input name="number" id="day" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;护理类型</label>
                <div class="layui-input-inline">
                    <input name="number" id="ofnursing" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;喂养类型</label>
                <div class="layui-input-inline">
                    <input name="number" id="foodd" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;睡眠情况</label>
                <div class="layui-input-inline">
                    <input name="number" id="Sleepcondition" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>




            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;身高</label>
                <div class="layui-input-inline">
                    <input name="number" id="heightr" placeholder="CM" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;体重</label>
                <div class="layui-input-inline">
                    <input name="number" id="weigth" lay-verify="required" placeholder="KG"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;头围</label>
                <div class="layui-input-inline">
                    <input name="number" id="head" lay-verify="required" placeholder="CM" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;体温</label>
                <div class="layui-input-inline">
                    <input name="number" id="temper" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;是否红臀</label>
                <div class="layui-input-inline">
                    <input name="number" id="Redbuttocks" lay-verify="required" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;黄疸值</label>
                <div class="layui-input-inline">
                    <input name="number" id="jaundice" lay-verify="required" placeholder="不超过15mg/dL " autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>


            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;吃奶</label>
                <div class="layui-input-inline">
                    <input name="number" id="Eatmink" placeholder="是否8——12h不吃奶" lay-verify="required" placeholder="不超过15mg/dL " autocomplete="off" class="layui-input isNull " type="text">
                </div>
            </div>







            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;抚触</label>
                <div class="layui-input-inline">
                    <input name="number" id="touch" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;洗澡</label>
                <div class="layui-input-inline">
                    <input name="number" id="shower" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;游泳</label>
                <div class="layui-input-inline">
                    <input name="number" id="swimming" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>


            <div class="layui-inline">
                <label class="layui-form-label" > 备注</label>
                <div class="layui-input-inline">
                    <input name="number" id="remarks2"   autocomplete="off" class="layui-input" type="text">
                </div>
            </div>
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;脐带护理</label>
                <div class="layui-input-inline">
                    <input name="number" id="umbilicalcord" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
        <#--<div class="layui-inline">
                                                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;大便情况</label>
                                                <div class="layui-input-inline">
                                                 <input name="number" id="shit" lay-verify="required"  placeholder="次数、色状" autocomplete="off" class="layui-input isNull" type="text">
                                                        </div>
                                                              </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;脐带消毒时间</label>
                <div class="layui-input-inline">
                    <input name="date" id="date" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;脐带脱落情况</label>
                <div class="layui-input-inline">
                    <input name="number" id="umbilicalCord" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;喂养时间</label>
                <div class="layui-input-inline">
                    <input name="date" id="date1" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;喂养奶量</label>
                <div class="layui-input-inline">
                    <input name="number" id="feedVolume" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;奶瓶消毒</label>
                <div class="layui-input-inline">
                    <input name="number" id="bottle" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;大便观察时间</label>
                <div class="layui-input-inline">
                    <input name="date" id="date2" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;大便观察色状</label>
                <div class="layui-input-inline">
                    <input name="number" id="shitChromatic" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;挤奶时间</label>
                <div class="layui-input-inline">
                    <input name="date" id="date3" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;挤奶奶量</label>
                <div class="layui-input-inline">
                    <input name="number" id="milkVolume" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
           <#-- <div class="layui-inline">
                <label class="layui-form-label" style="width:178px"><a style="color:red">*</a>&nbsp;小便时间</label>
                <div class="layui-input-inline">
                    <input name="date" id="date4" lay-verify="required|date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <#--<div class="layui-inline">
                <label class="layui-form-label" ><a style="color:red">*</a>&nbsp;小便色状</label>
                <div class="layui-input-inline">
                    <input name="number" id="urineChromatic" lay-verify="required"  autocomplete="off" class="layui-input isNull" type="text">
                </div>
            </div>-->
            <div class="layui-form-item"style="margin-left:320px">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-radius" lay-submit lay-filter="formDemo" type="button" onclick="babysbmint()" style="background-color: #0092EF;">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
                </div>
            </div>
        </div>
    </form>
<script>
layui.use(['form', 'layedit', 'laydate','layer'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
   //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
    laydate.render({
        elem: '#date2'
    });
    laydate.render({
        elem: '#date3'
    });
    laydate.render({
        elem: '#date4'
    });

  //监听提交
 // form.on('submit(formDemo)', function(data){
 //   layer.msg(JSON.stringify(data.field));
 //   return false;
 // });
});

function babysbmint(){
var jsonDate={};
    jsonDate.name= $("#name").val();
    jsonDate.roomId= $("#home_id").val();
    jsonDate.sex =$('input:radio[name="sex"]:checked').val();
    jsonDate.jaundice =$("#jaundice").val();
    jsonDate.eczema =$("#eczema").val();
    jsonDate.Hotrash =$("#Hotrash").val();
    jsonDate.Redbuttocks =$("#Redbuttocks").val();
    jsonDate.Eatmink =$("#Eatmink").val();
    jsonDate.umbilicalcord =$("#umbilicalcord").val();
    jsonDate.Sleepcondition =$("#Sleepcondition").val();
    jsonDate.people =$("#people").val();
    jsonDate.babynursery =$("#babynursery").val();
    jsonDate.day =$("#day").val();
    jsonDate.heightr =$("#heightr").val();
    jsonDate.head =$("#head").val();
    jsonDate.temper =$("#temper").val();
    jsonDate.foodd =$("#foodd").val();
    /*jsonDate.shit =$("#shit").val();*/
    jsonDate.shower =$("#shower").val();
    jsonDate.touch =$("#touch").val();
    jsonDate.remarks2 =$("#remarks2").val();
    jsonDate.weigth =$("#weigth").val();
    //脐带消毒时间
    jsonDate.umbilicalTime =$("#date").val();
    //脐带脱落情况
    jsonDate.umbilicalCord =$("#umbilicalCord").val();
    //喂养时间
    jsonDate.feedTime =$("#date1").val();
    //喂养奶量
    jsonDate.feedVolume =$("#feedVolume").val();
    //奶瓶消毒
    jsonDate.bottle =$("#bottle").val();
    //大便观察时间
    jsonDate.shitTime =$("#date2").val();
    //大便观察色状
    jsonDate.shitChromatic =$("#shitChromatic").val();
    //挤奶时间
    jsonDate.milkTime =$("#date3").val();
    //挤奶奶量
    jsonDate.milkVolume =$("#milkVolume").val();
    //游泳
    jsonDate.swimming =$("#swimming").val();
    //小便时间
    jsonDate.urineTime =$("#date4").val();
    //小便色状
    jsonDate.urineChromatic =$("#urineChromatic").val();
    //护理类型
    jsonDate.ofnursing =$("#ofnursing").val();
    //分娩方式
    jsonDate.delivery =$("#delivery").val();

      if(!isNull()){
      return;
      }
    $.ajax({
        type:"POST",
        url:"${base}/babyNursing/addbaByNursing",
        data:{"param":JSON.stringify(jsonDate)},
        success : function(data){
            layer.msg(data);
    setTimeout(function(){
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
             parent.layer.close(index); //再执行关闭
    },200)
            jsonDate.sex =$('input:radio[name="sex"]:checked').val("");
            jsonDate.name= $("#name").val("");
            jsonDate.roomId= $("#home_id").val("");
            jsonDate.jaundice =$("#jaundice").val("");
            jsonDate.eczema =$("#eczema").val("");
            jsonDate.Hotrash =$("#Hotrash").val("");
            jsonDate.Redbuttocks =$("#Redbuttocks").val("");
            jsonDate.Eatmink =$("#Eatmink").val("");
            jsonDate.Sleepcondition =$("#Sleepcondition").val("");
            jsonDate.umbilicalcord =$("#umbilicalcord").val("");
            jsonDate.people =$("#people").val("");
            jsonDate.babynursery =$("#babynursery").val("");
            jsonDate.day =$("#day").val("");
            jsonDate.heightr =$("#heightr").val("");
            jsonDate.head =$("#head").val("");
            jsonDate.temper =$("#temper").val("");
            jsonDate.foodd =$("#foodd").val("");
            /*jsonDate.shit =$("#shit").val("");*/
            jsonDate.shower =$("#shower").val("");
            jsonDate.touch =$("#touch").val("");
            jsonDate.remarks2 =$("#remarks2").val("");
            jsonDate.weigth =$("#weigth").val("");
            //脐带消毒时间
            jsonDate.umbilicalTime =$("#date").val("");
            //脐带脱落情况
            jsonDate.umbilicalCord =$("#umbilicalCord").val("");
            //喂养时间
            jsonDate.feedTime =$("#date1").val("");
            //喂养奶量
            jsonDate.feedVolume =$("#feedVolume").val("");
            //奶瓶消毒
            jsonDate.bottle =$("#bottle").val("");
            //大便观察时间
            jsonDate.shitTime =$("#date2").val("");
            //大便观察色状
            jsonDate.shitChromatic =$("#shitChromatic").val("");
            //挤奶时间
            jsonDate.milkTime =$("#date3").val("");
            //挤奶奶量
            jsonDate.milkVolume =$("#milkVolume").val("");
            //游泳
            jsonDate.swimming =$("#swimming").val("");
            //小便时间
            jsonDate.urineTime =$("#date4").val("");
            //小便色状
            jsonDate.urineChromatic =$("#urineChromatic").val("");
            //护理类型
            jsonDate.ofnursing =$("#ofnursing").val("");
            //分娩方式
            jsonDate.delivery =$("#delivery").val("");
            var table = parent.layui.table;
            //表刷新方法
            table.reload('testReload', {
                url: '${base}/babyNursing/selectBabyNursing'
                ,where: {} //设定异步数据接口的额外参数
            });
          }
    });
 }
//获取添加时候的房间id
var bas = "${base}"
//home:变量  = zhang.js里边封装的名称(路径,"字典表里边的code")
var home_data = getDataByDicCode(bas,"home")
for(var i=0;i<home_data.length;i++){
$("#home_id").append(
    ' <option value="'+home_data[i].id+'">'+home_data[i].name+'</option>'
)

}

</script>
	</body>
</html>
